Skip to content

fix(classroom): 課題詳細の Google Classroom 配信ボタンを復活 (#1045)#1046

Merged
takaokouji merged 2 commits into
developfrom
topic/autopilot-1045
Jul 12, 2026
Merged

fix(classroom): 課題詳細の Google Classroom 配信ボタンを復活 (#1045)#1046
takaokouji merged 2 commits into
developfrom
topic/autopilot-1045

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

概要

授業支援 EPIC #974 のクラス管理刷新で消えていた Google Classroom への課題配信ボタンを、課題詳細画面(課題名入力の右隣)に復活させる。

根本原因

配信ボタンの表示条件が 課題(classroom)単位の googleClassroomCourseId に依存していた。刷新で GC 連携が クラス(group)単位に移り、個々の課題は courseId が null になるためボタンが常に非表示になっていた。

変更内容

  • GUI (teacher-class-detail.jsx): 表示 gate を「実効 courseId(課題 OR クラス)」に変更。投稿済み/未投稿の分岐は従来どおり 課題単位の googleClassroomAlternateLink をキーにする(クラス連携済みでもこの課題が未投稿なら「配信」、投稿後は「課題を確認」リンク)。
  • バックエンド (handler.ts): 既に実装済みの group フォールバックを、resolveGoogleCourseId という exported な純粋関数に抽出し、handlePostAssignment から利用。挙動は不変。
  • テスト:
    • GUI: teacher-class-detail.test.jsx(新規)— クラスのみ連携/課題のみ連携/両方無し/投稿済みの 4 ケースで表示条件を pin。
    • バックエンド: handler-assignment.test.tsresolveGoogleCourseId の group フォールバックを pin。
  • ドキュメント: docs/classroom/ui-ux.md にクラス詳細の配信/確認ボタンと表示条件を追記。

テスト

  • npm exec jest test/unit/components/teacher-class-detail.test.jsx → 4 passed(RED→GREEN 確認済み)。
  • GUI 変更ファイルの eslint / prettier: clean。
  • バックエンドの unit テストは infra の docker サービスで実行される想定(本 worktree では infra の node_modules 差異により既存コードで TS 型エラーが出るため、CI に委譲。追加テストは既存の pure-function テスト形式に準拠)。

DoD

  • GC 連携済みクラスの課題詳細で「配信」ボタンが表示される(課題に courseId が無くても)
  • 投稿済みでは「課題を確認」リンクに切り替わる
  • 非連携クラスでは表示されない
  • GUI lint 通過 / 表示条件をテストで検証
  • バックエンドの group フォールバックをテストで pin
  • docs/classroom/ui-ux.md 更新

Closes #1045

The post-assignment button gated on the assignment's own googleClassroomCourseId, but the v2
refactor moved GC linkage to the class (group), so assignments have no courseId and the button
disappeared.

Gate the button on an effective courseId (assignment OR group), keeping the posted/unposted branch
on the assignment's own alternateLink. Extract resolveGoogleCourseId as an exported pure backend
helper and pin the group fallback with a unit test.

Closes #1045

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与) label Jul 12, 2026
@smalruby3-editor-bot

smalruby3-editor-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown
Author

🤖 autopilot status

field value
Status Review
AI Status
HITL Yes
Size middle

Linked issue #1045. Maintained by autopilot (single writer); do not edit.

@github-actions

Copy link
Copy Markdown

🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/topic/autopilot-1045/

review follow-ups for #1045:
- add teacher-class-detail.test.jsx to scratch-gui .prettierignore whitelist
  and reformat it with prettier (code-style rule: new smalruby files must be
  prettier-covered)
- correct the post/view assignment button labels in docs/classroom/ui-ux.md
  to match the actual UI text (課題を配信 / 課題を確認)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@smalruby3-editor-bot

Copy link
Copy Markdown
Author

[Must] 新規テスト test/unit/components/teacher-class-detail.test.jsxpackages/scratch-gui/.prettierignore のホワイトリストに未登録で、Prettier のフォーマットも当たっていませんでした(code-style.md の「新しい Smalruby 固有ファイルはホワイトリストに追加する」規約からの逸脱。ホワイトリスト外だと format:check を素通りしてしまい整形が担保されない)。

対応済み: bin/bot-git でコミット f9e6eb9ce1

  • 当該テストを prettier で整形し直し
  • .prettierignore!test/unit/components/teacher-class-detail.test.jsx を追加

npx prettier --check clean・4 tests green を確認済み。

@smalruby3-editor-bot

Copy link
Copy Markdown
Author

[Question] 表示 gate をクラス(group)単位の courseId に広げたことで、Google Classroom 連携済みクラスを Microsoft でログインした先生(co-teacher 等)が開くと「課題を配信」ボタンが表示されるが押しても無反応になる可能性があります。classroom-teacher-modal.jsx:284onShowPostAssignmentauthProvider === 'google' のときのみ非 null に渡されるため、非 Google の先生には onClick={null} の死にボタンになります。

  • 改修前は courseId が課題単位で、GC import(Google 認証必須)でしか付かなかったため、非 Google の先生にこのボタンが出ることはありませんでした(=本 PR で新たに露出しうるコーナーケース)。
  • 稀(Microsoft co-teacher が GC 連携済みクラスを閲覧する場合のみ)かつクラッシュではないため、自動修正はせず設計判断を人間に委ねます。案としては ①post ボタンを onShowPostAssignment 有無でも gate する(view リンクは provider 非依存で残す)②非 Google では配信 UI をそもそも出さない、等。

@smalruby3-editor-bot

Copy link
Copy Markdown
Author

[FYI] docs/classroom/ui-ux.md に追記されたボタン表示名が実 UI と不一致でした(「Google Classroom に配信 / で確認」→ 実際は locale gui.classroom.postAssignment.title = 「課題を配信」、...viewAssignment = 「課題を確認」)。ドキュメントの表示名列は実 UI テキストを反映する運用のため、コミット f9e6eb9ce1 で実テキストに合わせて修正しました。

@smalruby3-editor-bot

Copy link
Copy Markdown
Author

🤖 敵対的レビュー完了。指摘 3 件(Must 1 / Question 1 / FYI 1)。Must と FYI は修正済み(f9e6eb9ce1)。Question は設計判断のため人間レビューに委ねます。

@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🙋 HITL 人間の対応待ち(Project HITL=Yes の投影) label Jul 12, 2026
@smalruby3-editor-bot smalruby3-editor-bot Bot marked this pull request as ready for review July 12, 2026 19:41
@takaokouji takaokouji merged commit a99f77c into develop Jul 12, 2026
21 checks passed
@takaokouji takaokouji deleted the topic/autopilot-1045 branch July 12, 2026 22:31
github-actions Bot pushed a commit that referenced this pull request Jul 12, 2026
…lot-1045

fix(classroom): 課題詳細の Google Classroom 配信ボタンを復活 (#1045)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与) 🙋 HITL 人間の対応待ち(Project HITL=Yes の投影)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(classroom): 課題詳細の Google Classroom 配信ボタンを復活(クラス単位 courseId で判定)

1 participant